<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        var obj = {
            name: 'abc',
            age: 123,
            sex: 'female',
            card: [1, 2] 
        }

        var obj1 = {};

        function clone(origin, target) {
            target = target || {};
            for(var prop in origin){
                target[prop] = origin[prop];
            }
            return target;
        }

        clone(obj, obj1);  //只针对原始值
        obj.card.push(1);  //一个改变另一个跟着改
        // 返回数组的长度


    </script>
</body>
</html>